Skip to main content

UiRoot

The root container for all UI elements in UniqueUI.
UiRoot manages the top-level node hierarchy, event dispatching, and rendering order.
It acts as the entry point for your entire interface, typically stored in a global variable like global.UI.


Constructor

new UiRoot()

Description

Creates a new root node responsible for:

  • Storing all top-level UI nodes.

  • Managing mouse and keyboard events.

  • Handling redraw requests (needsRedraw flag).

  • Managing layout and rendering through GameMaker’s flexpanel functions.

Usually, you only need one instance of UiRoot per scene or project.


Properties

NameTypeDescription
rootbooleanAlways true for the root node. Used to identify the top-level container.
needsUpdatebooleanTriggers a full layout recalculation via FlexPanel.
needsRedrawbooleanMarks the UI as dirty — causes re-rendering on the next render() call.
layoutUpdatedbooleantrue if a new layout was computed during the last update().

Methods

MethodReturnsDescription
setSize(w, h)UiRootSets the root node’s dimensions and resizes the spatial grid accordingly.
update()voidUpdates layout, mouse input, hover detection, drag events, and dispatches UI events. Should be called every step.
render(debug = false)voidRenders the UI tree to an internal surface and draws it to the screen. If debug = true, draws element bounds and names.
setName(name)voidInherited from UiNode; sets the FlexPanel node name (used in debug view).